class Board {
public:
    bool check(vector<vector<int>>& board, int i, int j)
    {
        int num1 = board[i-1][j]+board[i][j]+board[i+1][j];
        int num2 = board[i][j-1]+board[i][j]+board[i][j+1];
        int num3 = board[i+1][j-1]+board[i][j]+board[i-1][j+1];
        int num4 = board[i-1][j-1]+board[i][j]+board[i+1][j+1];
        if(num1 == 3 || num2 == 3 || num3 == 3 || num4 == 3){
            return true;
        }
        else{
            return false;
        }
    }
    bool checkWon(vector<vector<int> > board) {
        int row = board.size();
        int col = board[0].size();
        for(int i = 1; i < row - 1; ++i){
            for(int j = 1; j < col - 1; ++j){
                if(check(board, i, j)){
                    return true;
                }
            }
        }
        return false;
    }
};